#include <stdio.h>
#include "process.h"
#include <time.h>
#include <stdlib.h>

float total = 1024.0f;
float speed = 0.5f;

void download()
{
  float nowload = 0;
  
  while(nowload < total)
  {
    nowload += (rand() % 10 + 1) * speed;//档位有10个，每个档位的下载速度是0.5的倍数
    if(nowload > total) nowload = total;
    progress(nowload, total);
  }
}

int main()
{
  srand(time(NULL));
  printf("main ready...\n");
  progress_init();

  download();

  printf("\nmain complete...\n");
  return 0;
}
